import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';

//列表数据
export const columns: BasicColumn[] = [
  {
    title: '标题',
    align: 'center',
    dataIndex: 'title',
  },
  {
    title: '正文',
    align: 'center',
    dataIndex: 'content',
  },
  {
    title: '上图',
    align: 'center',
    dataIndex: 'topFileList',
  },
  {
    title: '中图',
    align: 'center',
    dataIndex: 'middleFileList',
  },
  {
    title: '下图',
    align: 'center',
    dataIndex: 'bottomFileList',
  },
  // {
  //   title: '获奖时间',
  //   align: 'center',
  //   dataIndex: 'awardTime',
  // },
  {
    title: '状态',
    align: 'center',
    dataIndex: 'status_dictText',
  },
  {
    title: '序号',
    align: 'center',
    dataIndex: 'seq',
  },
];

export const statusOptions = [
  { label: '生效', value: '1' },
  { label: '失效', value: '0' },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  // {
  //   label: '板块',
  //   field: 'sysOrgCode',
  //   component: 'JDictSelectTag',
  //   colProps: { span: 8 },
  //   componentProps: () => {
  //     return {
  //       dictCode: 'text_block',
  //     };
  //   },
  // },
  // {
  //   label: '区域',
  //   field: 'area',
  //   component: 'JDictSelectTag',
  //   colProps: { span: 8 },
  //   componentProps: () => {
  //     return {
  //       dictCode: 'honor_region',
  //     };
  //   },
  // },
  {
    label: '状态',
    field: 'status',
    component: 'Select',
    componentProps: {
      options: statusOptions,
    },
  },
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '标题',
    field: 'title',
    component: 'Input',
    required: true,
  },
  {
    label: '正文',
    field: 'content',
    component: 'InputTextArea',
    required: true,
    // componentProps: {
    //   //是否禁用
    //   disabled: false
    // },
  },
  // {
  //   label: '获奖时间',
  //   field: 'awardTime',
  //   component: 'DatePicker',
  //   componentProps: {
  //     showTime: true,
  //     valueFormat: 'YYYY-MM-DD HH:mm:ss',
  //   },
  // },
  {
    label: '上图',
    field: 'topFileList',
    component: 'JImageUpload',
    required: true,
    componentProps: ({ formModel }) => {
      return {
        dictCode: 'database_type',
        fileType: 'honorTop',
        onChange: (e: any) => {
          console.log('dddd', e);
        },
      };
    },
  },
  {
    label: '中图',
    field: 'middleFileList',
    component: 'JImageUpload',
    required: true,
  },
  {
    label: '下图',
    field: 'bottomFileList',
    component: 'JImageUpload',
    required: true,
  },
  // {
  //   label: '状态',
  //   field: 'status',
  //   component: 'Input',
  // },
  // {
  //   label: '序号',
  //   field: 'seq',
  //   component: 'InputNumber',
  // },
];

// 高级查询数据
export const superQuerySchema = {
  area: { title: '区域', order: 0, view: 'text', type: 'string' },
  areaEn: { title: '区域英文', order: 1, view: 'text', type: 'string' },
  title: { title: '标题', order: 2, view: 'text', type: 'string' },
  content: { title: '正文', order: 3, view: 'textarea', type: 'string' },
  awardTime: { title: '获奖时间', order: 4, view: 'datetime', type: 'string' },
  status: { title: '状态', order: 5, view: 'text', type: 'string' },
  seq: { title: '序号', order: 6, view: 'number', type: 'number' },
};

/**
 * 流程表单调用这个方法获取formSchema
 * @param param
 */
export function getBpmFormSchema(_formData): FormSchema[] {
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
